package week3;

/**
 * Created by Administrator on 2016/3/19.
 */
class CashCard3 {
    private String number;//使用private定义私有成员
    private int balance;
    private int bonus;
    CashCard3(String number,int balance,int bonus){
        this.number = number;
        this.balance = balance;
        this.bonus = bonus;
    }
    void store(int money){//要修改balance，得通过store()定义的流程
        if (money > 0){
            this.balance += money;
            if (money >= 1000){
                this.bonus++;
            }
        }
        else {
            System.out.println("储值是负的？你是在乱来吗？");
        }
    }
    int getBalance(){//提供取值方法成员
        return balance;
    }
    int getBonus(){
        return bonus;
    }
    String getNumber(){
        return number;
    }
}
